//
//  ViewController.m
//  UI18-SQLite(数据库)
//
//  Created by 韩旭 on 16/8/8.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "ViewController.h"
#import "SQLiteDataBaseManger.h"
#import "Student.h"

@interface ViewController ()
@property (nonatomic, strong) SQLiteDataBaseManger *manger;

@end

@implementation ViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    _manger = [SQLiteDataBaseManger shareManger];
//    SQLite3
//    注意使用sqlite需要引用libsqlite3.0tbd
//    这是一个库
//    libsqlite3.0tbdlibsqlite3.tbd区别
//    libsqlite3.0是libsqlite3三千里te的替身文件, 防止用户吴删
}
- (IBAction)Open:(id)sender {
    [_manger openSQLite3];
}
- (IBAction)closeSQL:(id)sender {
    [_manger closeSQLite3];
}
- (IBAction)creatTable:(id)sender {
    [_manger creatTable];
}
- (IBAction)insertInto:(id)sender {
    Student *stu = [[Student alloc] init];
    stu.stu_id = 12;
    stu.stu_name = @"李其昌";
    [_manger insertStu:stu];
}
- (IBAction)delete:(id)sender {
    Student *stu = [[Student alloc] init];
    stu.stu_id = 12;
    [_manger deleteStu:stu];
//    [_manger deleteAll];
}
- (IBAction)upDate:(id)sender {

    [_manger upDateOldName:@"李其昌" newName:@"王道林"];
}
- (IBAction)selectAll:(id)sender {
  NSArray *arr = [_manger selectName];
    NSLog(@"%@", arr);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
